1. Field of the Invention
The present invention relates to a waveform data interpolation device and a waveform data interpolation program for calculating a waveform value at an arbitrary waveform position on waveform data which indicates, as waveform sample values, a plurality of waveform values sampled at different waveform positions.
2. Description of the Related Art
Some music sound production apparatuses such as electronic music instruments, etc. calculate a waveform sample value (a waveform value) of a music sound to be produced, by using waveform data indicating, as waveform sample values, a plurality of waveform values sampled at different waveform positions. Such a music sound production apparatus calculates waveform values other than some sampling points by interpolation, in order to produce music sounds at various pitches based on one piece of waveform data. As the result of calculating waveform values other than the sampling points by interpolation, it is possible to produce a music sound at a pitch assigned to a pressed key on the keyboard, or add acoustic effects such as detuning, vibrato, etc.
FIG. 6 shows a conventional method of calculating waveform values other than the sampling points (waveform values other than the sampling points will hereinafter be referred to as“interpolation values”). This calculation method is called linear interpolation. In linear interpolation, an interpolation value is a value of a point existing on a line that connects waveform sample values of adjoining sampling points. The circles in the drawing indicate the waveform sample values at the sampling points, and the square existing on the line connecting the waveform sample values of the adjoining sampling points indicates the interpolation value.
In linear interpolation as shown in FIG. 6, the medium portion between the waveform sample values is approximated by using a line. However, wave crests are generally not linear but curving. Therefore, there is a problem that an interpolation value calculated by linear interpolation often greatly differs from the actual waveform values. It is the actual circumstance that a high interpolation accuracy is hard to obtain due to this problem and that the music sound to be produced is greatly distorted in many cases. This is remarkable particularly in a case where waveform data includes many components that have a frequency half or lower of the sampling frequency, or in a case where the oversampling ratio at the time of output is high.
Since linear interpolation has the above-described problem, interpolation with a higher interpolation accuracy is practiced. A waveform data interpolation device disclosed in, for example, the publication of Japanese Patent No. 3223280 is raised as one that implements a conventional method of such interpolation. The method of interpolation implemented by this conventional waveform data interpolation device will be specifically explained with reference to FIG. 7. In FIG. 7, the X axis represents time (waveform position), and the Y axis represents waveform value. The X axis represents time in the unit of sampling point.
The interpolation method of the conventional waveform data interpolation device disclosed in the publication of Japanese Patent No. 3223280 is as follows. First, a first curve Y1(x) is found, which runs on the waveform sample values of two sampling points prior to an arbitrary waveform position on waveform data, and the waveform sample value of one sampling point posterior to that arbitrary waveform position. Next, a second curve Y2(x) is found, which runs on the waveform sample value of one sampling point prior to that waveform position, and the waveform sample values of two sampling points posterior to that waveform position. Then, a third curve Ys(x) is found, which runs between Y1(x) and Y2(x) (for example, the average of Y1(x) and Y2(x)). A value on Ys(x) is calculated as the interpolation value of that waveform position. For this purpose, in FIG. 7, the waveform sample values of the respective sampling points are represented in a coordinate system in which the waveform sample value of the sampling point existing immediately prior to the arbitrary waveform position is moved to the origin. Thus, the waveform sample value of the sampling point prior to the arbitrary position by two points has coordinates (−1, −d0), the waveform sample value of the sampling point immediately posterior to the arbitrary position has coordinates (1, d1), and the waveform sample value of the sampling point posterior to the arbitrary position by two points has coordinates (2, d2).
In FIG. 7, d0 to d2 each represent a value of difference calculated with respect to the waveform sample value of the sampling point on the origin, and δ−1 to δ+1 each represent a value of difference calculated with respect to the waveform sample value of the sampling point that is nearest to each sampling point. Based on this, the respective values of difference d0 to d2 are calculated as follows, on the conditions that the waveform sample value of the sampling point prior by two points is indicated as L−1, the waveform sample value of the sampling point on the origin is indicated as L0, the waveform sample value of the sampling point immediately posterior is indicated as L+1, and the waveform sample value of the sampling point posterior by two points is indicated as L+2.d2=L+2−L0d1=L+1−L0d0=L0−L−1  (1)
Further, the respective values of difference δ−1 to δ+1 can be calculated as follows.δ+1=L+2−L+1δ0=L+1−L0δ−1=L0−L−1  (2)
The conventional waveform data interpolation device disclosed in the publication of Japanese Patent No. 3223280 realizes a higher interpolation accuracy by performing the above-described interpolation. However, due to the interpolation in this manner, the device requires more calculations than required in linear interpolation.
Calculations for interpolation can be done not only by software processing, but by hardware. As the amount of calculations grows, a heavier load is put on the hardware, not only in the case where the calculations are done by hardware processing, but also in the case where the calculations are done by software processing. Thus, in order that processes with a heavier load can be done properly, it is necessary to prepare a processing device with a higher performance, or prepare a processing device limited to this purpose only. Therefore, it is desired that the amount of calculations be reduced as much as possible.
It is common that the hardware for performing calculations for interpolation will have a more complex structure and be larger-scaled as the amount of calculations increases. These accompanying situations both increase the manufacturing costs. Thus, it is desirable that the amount of calculations be reduced also in the case where the calculations are done by hardware.